/*
 * Copyright (c) 2023, 2024,yzc.cn All rights reserved.
 *
 */
package cn.yzc.factory_pattern.simple;

/**
 * <p>Project: springbootDemo - SimpleCoffeeFactory</p>
 * <p>Powered by yzc On 2024-03-20 10:10:29</p>
 * <p>描述：<p>
 *
 * @author yzc [youzhicheng0415@163.com]
 * @version 1.0
 * @since 17
 */
//简单工厂模式
public class SimpleCoffeeFactory {
    public Coffee orderCoffee(String type){
        Coffee coffee = null;
        if (type.equals("america")) {
            coffee = new AmericaCoffee();
        } else if (type.equals("latte")){
            coffee = new LatteCoffee();
        }else {
            throw new RuntimeException("对不起，你点的产品卖完");
        }
        return coffee;
    }
}
